import React, { useState } from 'react';
import { NavigationProp, RouteProp } from '@react-navigation/native';
import { ScrollView, StyleSheet } from 'react-native';
import { WebView } from 'react-native-webview';
import { LinearProgress } from '@rneui/base';
import { CommonStyle } from '../../common/commonStyle.ts';
interface IUserAgreementScreenProps {
  navigation: NavigationProp<any, 'userAgreement'>;
  route: RouteProp<{ userAgreement: any }, 'userAgreement'>;
}
const UserAgreementScreen: React.FC<IUserAgreementScreenProps> = ({ navigation, route }) => {
  const [loading, setLoading] = useState(true);

  return (
    <ScrollView contentContainerStyle={styles.container}>
      {loading && <LinearProgress color={CommonStyle.mainColor} />}
      <WebView source={{ uri: 'https://h5.kanglailab.com/app/userAgreement' }} style={styles.webView} onLoad={() => setLoading(false)} />
    </ScrollView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  webView: {
    flex: 1,
  },
});

export default UserAgreementScreen;
